Tool Result
@Serializable
Tool execution emitted a result. By default this is the final result — appended to the model's message log + dispatched to UI converters.
Tools whose executor is a kotlinx.coroutines.flow.Flow (built via streamingTool { ... }) can emit intermediate progress snapshots before the final value; those land as ToolResult(preliminary = true). Preliminary results show in the UI (state stays OutputAvailable, preliminary flag set) but do NOT go to the model — the model only sees the final value once the Flow completes.
Constructors
Link copied to clipboard
constructor(toolCallId: String, toolName: String, outputJson: JsonElement, output: ToolResultOutput = toolResultOutputFromJson(outputJson), modelOutput: ToolResultOutput = output, isError: Boolean = modelOutput is ToolResultOutput.Error ||
modelOutput is ToolResultOutput.ErrorJson ||
modelOutput is ToolResultOutput.ExecutionDenied, preliminary: Boolean = false, providerMetadata: Map<String, JsonElement>? = null)